﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace LunarSF.SHomeWorkshop.LunarMarkdownEditor
{
    class PythonScriptMenuItem : MenuItem
    {
        public PythonScriptMenuItem(Button psToolButton)
        {
            this.Style = TryFindResource("MetroMenuItem") as Style;
            psButton = psToolButton;
            if (psButton != null)
            {
                this.Header = psButton.Content as string;
                this.Tag = psButton.Tag;
            }
            this.Click += PythonScriptMenuItem_Click;
        }

        private void PythonScriptMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (psButton != null)
            {
                var psli = psButton.Tag as PythonScriptListItem;
                psli?.RunScript();
            }
        }

        private Button psButton = null;
        public Button PsButton
        {
            get { return psButton; }
        }
    }
}
